const { Menu } = require('electron')
let template = [
  {
    label: '菜单',
    submenu: [
      {label: '子菜单1'},
      {label: '子菜单2'},
    ]
  },
  {
    label: '菜单2',
    submenu: [
      {
        label: '子菜单1',
        accelerator: 'command+n',
        click: () => {
          console.log(111)
        }
      },
      {label: '子菜单2'},
    ]
  }
]

const m = Menu.buildFromTemplate(template)
Menu.setApplicationMenu(m)